

//
//  URLViewController.swift
//  Swift 3.0 基础语法
//
//  Created by YYY on 2017/7/19.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

import UIKit

class URLViewController: CommonViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let url = URL(string: "https://www.baidu.com")
        
 
        
    
        URLSession.shared.dataTask(with: url!) { (data, _, error) in
            
            
            guard let data = data else
            {
                print("网络请求失败\(error)")
                return
            }
            
            let html = String(data: data, encoding: .utf8)
            print(html)
        }.resume()
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
